package com.piggy.logi.sys.api.factory;

import com.piggy.logi.sys.api.RemoteLogiRoleMenuService;
import com.piggy.logi.sys.api.domain.LogiSysUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 角色服务降级处理
 *
 * @author shark
 */
@Component
public class RemoteLogiRoleMenuFallbackFactory implements FallbackFactory<RemoteLogiRoleMenuService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteLogiRoleMenuFallbackFactory.class);

    @Override
    public RemoteLogiRoleMenuService create(Throwable throwable) {
        log.error("角色菜单服务调用失败:{}", throwable.getMessage());
        return new RemoteLogiRoleMenuService()
        {

            @Override
            public List<LogiSysUser> getAssignees(List<String> menuIds, String source) {
                return null;
            }

        };
    }
}
